#ifndef NEOROLLERPRIVATE_H
#define NEOROLLERPRIVATE_H

#include "stdafx.h"
#include <QPainter>

class QPropertyAnimation;
class NeoRoller;
class NeoRollerPrivate : public QObject
{
    Q_OBJECT
    NEO_PRIVATE_CREATE(NeoRoller)
    NEO_PROPERTY_CREATE(int, Offset)
    NEO_PRIVATE_PROPERTY_CREATE_H(QString, CurrentItem)
    NEO_PRIVATE_PROPERTY_CREATE_H(QStringList, Items)
    NEO_PRIVATE_PROPERTY_CREATE_H(int, MaxVisibleItems)
    NEO_PRIVATE_PROPERTY_CREATE_H(QColor, BackgroundColor)
    NEO_PRIVATE_PROPERTY_CREATE_H(QColor, SelectorColor)
    NEO_PRIVATE_PROPERTY_CREATE_H(QColor, TextColor)
    NEO_PRIVATE_PROPERTY_CREATE_H(QColor, SelectorTextColor)
public:
    NeoRollerPrivate(QObject *parent = nullptr);
    ~NeoRollerPrivate();

    void updateWidgetGeometry(QSize size);
    // When viewed from the left side, this component ensures that the rotation proceeds in a clockwise direction.
    void updateCurrentItem(int index, bool clockwise = true);

    void drawBackground(QPainter *painter);
    void drawItems(QPainter *painter);
    void drawSelector(QPainter *painter);

private:
    int pPreviousIndex;
    int pCurrentIndex;
    int pNextIndex;
    int pItemHeight;
    QPropertyAnimation *pOffsetAnimation;
};

#endif